<!-- view list student enrolled -->

<?php $this->load->view('include/header'); ?>

<?php 
	if ($this->session->userdata('user_type') == 1)
		if ($this->session->userdata('status') == 2)
			echo '<script type="text/javascript"> alert("Congratulations! You have been accepted!"); </script>';
		else if ($this->session->userdata('status') == 3)
			echo '<script type="text/javascript"> alert("Sorry! You are not good enough! You can wait for teacher change his mind or quit to enroll another topic"); </script>';
	echo "<table border='1'>
	<tr>
	<th>Id</th>
	<th>Name</th>
	<th>Status</th>
	</tr>";
	foreach($rows as $r){
		if ($r){
			echo "<tr>";
			echo '<td>'.$r->user_id.'</td>';
			echo '<td>'.anchor('student/viewdetail/'.$r->user_id,$r->firstname.' '.$r->lastname).'</td>';
			if ($r->status == 1)
				echo '<td>'."Waiting".'</td>';
			else if ($r->status == 2)
				echo '<td>'."Accepted".'</td>';	
			else if ($r->status == 3)
				echo '<td>'."Rejected".'</td>';	
			echo "</tr>";	
			$this->session->set_userdata('studentId',$r->user_id);
		}
		else 
			echo '<p>'."There is no students enrolled".'</p>';
	}
	echo "</table>";
?>

<?php $this->load->view('include/footer'); ?>
